﻿//using System.Collections.Generic;
//using UnityEngine;
//using VoxelBlock.VoxelBlock3D;
//using VoxelBlock;using Vector3Int = VoxelBlock.Vector3Int;

//public class OperationImplementLineAddOrPaint : OperationImplement
//{
//    Vector3Int rectangleOldPosition;


//    //public OperationImplementLineAddOrPaint(ProxyOperation proxy) : base(proxy)
//    //{

//    //}

//    public override void Start(StartArg arg)
//    {
//        base.Start(arg);
//        rectangleOldPosition = arg.StartPosition;
//    }

//    public override void Run(RunArg arg)
//    {
//        //if (rectangleOldPosition != nowSelectPosition)
//        //{
//        //    Vector3Int positionA = gestureStartPosition;
//        //    rectangleOldPosition = nowSelectPosition;

//        //    List<Voxel3D> addArray = BasicAlgorithm.GetLineBlock3D(positionA, rectangleOldPosition, nowSelectUVKey);

//        //    Vector3Int[] arrayPoint = new Vector3Int[oldSerializeVoxel.Count];
//        //    for (int i = 0, max = oldSerializeVoxel.Count; i < max; i++)
//        //    {
//        //        arrayPoint[i] = oldSerializeVoxel[i].position;
//        //    }
//        //    nowDrawVoxel3DCore.DrawRemoveBlock(arrayPoint);
//        //    oldSerializeVoxel = nowDrawVoxel3DCore.DrawAddBlock(addArray);
//        //}

//        if (rectangleOldPosition != arg.nowSelectPosition)
//        {
//            Vector3Int positionA = arg.gestureStartPosition;
//            rectangleOldPosition = arg.nowSelectPosition;

//            Voxel3D[] addArray = BasicAlgorithm.GetRectangleVoxelArray(positionA, rectangleOldPosition, arg.nowSelectUVKey);

//            var array = BasicAlgorithm.GetLineBlock3D(positionA, rectangleOldPosition);

//            Vector3Int[] arrayPoint = new Vector3Int[historyRecordBreakList.Count];
//            for (int i = 0, max = historyRecordBreakList.Count; i < max; i++)
//            {
//                arrayPoint[i] = historyRecordBreakList[i].position;
//            }
//            nowDrawVoxel3DCore.DrawRemoveBlock(arrayPoint);
//            nowDrawVoxel3DCore.DrawAddBlock(historyRecordFrontList);

//            var data = nowDrawVoxel3DCore.DrawAddOrPaintBlock(array, arg.nowSelectUVKey);
//            if (data == null)
//            {
//                historyRecordBreakList = new List<SimpleVoxel>();
//                historyRecordFrontList = new List<SimpleVoxel>();
//            }
//            else
//            {
//                historyRecordFrontList = data.Item1;
//                historyRecordBreakList = data.Item2;
//            }
//        }
//    }

//    public override void Over(OverArg arg)
//    {
//        if (isStop)
//        {
//            if (historyRecordBreakList.Count > 0 || historyRecordFrontList.Count > 0)
//            {
//                historyRecordFrontList = new List<SimpleVoxel>();
//                historyRecordBreakList = new List<SimpleVoxel>();
//            }
//        }
//        else
//        {
//            if (historyRecordBreakList.Count > 0 || historyRecordFrontList.Count > 0)
//            {
//                proxy.Write(VoxelCategories.Operation.AddOrPaint, historyRecordFrontList, historyRecordBreakList);
//                historyRecordFrontList = new List<SimpleVoxel>();
//                historyRecordBreakList = new List<SimpleVoxel>();
//            }
//            else
//            {
//                var data = nowDrawVoxel3DCore.DrawAddOrPaintBlock(new Vector3Int[] { arg.nowSelectPosition }, arg.nowSelectUVKey);
//                historyRecordFrontList = data.Item1;
//                historyRecordBreakList = data.Item2;
//                if (historyRecordBreakList.Count > 0 || historyRecordFrontList.Count > 0)
//                {
//                    proxy.Write(VoxelCategories.Operation.AddOrPaint, historyRecordFrontList, historyRecordBreakList);
//                    historyRecordFrontList = new List<SimpleVoxel>();
//                    historyRecordBreakList = new List<SimpleVoxel>();
//                }
//            }
//        }
//    }

//}


